<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
       xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="/header.xhtml">
            <ui:define name="menu">
                  <h:commandLink value="Inicio" action="/header.xhtml"/>
        </ui:define>
        <ui:define name="conteudo">
        <legend><i class="icon-edit"></i>Cadastro de usuário</legend>

            <h:inputHidden value="#{usuarioMB.usuario.id}"/>
            <div style="margin-left: 45px;">
                <h:panelGrid columns="1">

                    <h:outputLabel class="control-label">Id</h:outputLabel>
                    <h:inputText value="#{usuarioMB.usuario.id}" class="input-large" required="true" readonly="true" />

                    <h:outputLabel class="control-label">Nome</h:outputLabel>
                    <h:inputText value="#{usuarioMB.usuario.nome}" class="input-large" required="true"/>

                    <h:outputLabel class="control-label">Email</h:outputLabel>
                    <h:inputText value="#{usuarioMB.usuario.email}" class="input-large" required="true"/>
                    
                    <h:outputLabel class="control-label">Telefone</h:outputLabel>
                    <h:inputText value="#{usuarioMB.usuario.telefone}" class="input-large" required="true"/>

                    <h:outputLabel class="control-label">Perfil</h:outputLabel>

                    <!-- 
                        O atributo value é ligado no atributo conta do objeto lancamento constante na classe LancamentoMB.
                        O atributo converter permite definir qual classe será utilizada para conversão de objeto do tipo Conta.                                    
                    -->                
                    <h:selectOneMenu value="#{usuarioMB.usuario.perfil}" 
                                    >  <!--converter="conversorPerfil"-->
                        <f:selectItems value="#{usuarioMB.perfil}" var="perfil" 
                                       itemLabel="#{perfil}" 
                                       itemValue="#{perfil}" 
                                       noSelectionValue="Selecione um perfil."/>
                    </h:selectOneMenu>
                    
                    <h:outputLabel class="control-label">Login</h:outputLabel>
                    <h:inputText value="#{usuarioMB.usuario.login}" class="input-large" required="true"/>
                    
                    <h:outputLabel class="control-label">Senha</h:outputLabel>
                    <h:inputSecret value="#{usuarioMB.usuario.senha}" class="input-large" required="true"/>
                    
                     <h:outputLabel class="control-label">Confirmar Senha</h:outputLabel>
                    <h:inputSecret value="#{usuarioMB.usuario.senha}" class="input-large" required="true"/>

                </h:panelGrid>

            </div>
            <div class="form-actions">
                <h:commandButton value="Salvar" action="#{usuarioMB.salvar()}" class="btn btn-inverse  pull-right" onclick="return confirm('Deseja realmente salvar?')"></h:commandButton>
                <h:commandButton value="Limpar" action="#{usuarioMB.novo()}" class="btn  pull-left"></h:commandButton></div>
        </ui:define>
    </ui:composition>
</html>

